package run.siyuan.jdk.设计模式.工厂模式.工厂模式案例1;

/**
 * @className: AbstractHumanFactory
 * @Description: TODO 工程模式-人类创建工厂
 * @author: siyuan
 * @date: 2022/3/11 5:57 PM
 */
public class HumanFactory extends AbstractHumanFactory {

    @Override
    public Human createHuman(Class c) {
        Human human = null;
        try {
            human = (Human) Class.forName(c.getName()).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return human;
    }
}
